/* eslint-disable*/

'use strict';

module.exports = dc => {
  const DataTypes = dc.ORM;
  const sequelize = dc.orm;
  const User = sequelize.define("user", {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      comment: null,
      primaryKey: true,
      field: "id",
      autoIncrement: true,
      unique: "user_id_uindex"
    },
    name: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: null,
      comment: null,
      primaryKey: false,
      field: "name",
      autoIncrement: false
    },
    username: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: null,
      comment: null,
      primaryKey: false,
      field: "username",
      autoIncrement: false
    },
    password: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: null,
      comment: null,
      primaryKey: false,
      field: "password",
      autoIncrement: false
    },
    depId: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      comment: "部门id",
      primaryKey: false,
      field: "dep_id",
      autoIncrement: false,
      references: {
        key: "id",
        model: "department"
      }
    },
    roleId: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      comment: "角色id",
      primaryKey: false,
      field: "role_id",
      autoIncrement: false,
      references: {
        key: "id",
        model: "role"
      }
    },
    sort: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: null,
      comment: "排序 int",
      primaryKey: false,
      field: "sort",
      autoIncrement: false
    },
    post: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      comment: "职位  1:部门主管   2:一般成员",
      primaryKey: false,
      field: "post",
      autoIncrement: false
    },
    phone: {
      type: DataTypes.STRING,
      allowNull: true,
      defaultValue: null,
      comment: null,
      primaryKey: false,
      field: "phone",
      autoIncrement: false
    },
    email: {
      type: DataTypes.STRING,
      allowNull: true,
      defaultValue: null,
      comment: null,
      primaryKey: false,
      field: "email",
      autoIncrement: false
    },
    enable: {
      type: DataTypes.BOOLEAN,
      allowNull: false,
      defaultValue: null,
      comment: "是否启用",
      primaryKey: false,
      field: "enable",
      autoIncrement: false
    }
  }, {
    tableName: "user",
    comment: "",
    indexes: []
  });
  dc.models.User = User;
  return User;
};